package util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUitl {
	public static final String FORMAT_DATESTAMP = "yyyy-MM-dd HH:mm:ss";
	public static final String FORMAT_DATE = "yyyy-MM-dd";

	public static Date stringToDate(String dateString, String fmt) {
		SimpleDateFormat ft = new SimpleDateFormat(fmt);
		Date date = null;
		try {
			date = ft.parse(dateString);

		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return date;

	}

	public static Date stringToDate(String dateString) {
		return stringToDate(dateString, DateUitl.FORMAT_DATE);

	}

}
